package hello.controller;

import hello.model.HelloBean;

import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author majinding888@foxmail.com
 * @date 2016-12-21 上午10:43:48
 */
@Controller
public class HelloController {

	@RequestMapping("/hello")
	public String hello(Model model) {
		model.addAttribute("msg", "你好!");
		return "hello";
	}

	@RequestMapping("/hello/json")
	@ResponseBody
	public Object helloBean() {
		HelloBean hello = new HelloBean();
		hello.setId(123);
		hello.setMsg("你好!");
		hello.setDate(new Date());
		return hello;
	}

}
